package itman.controller;

import itman.po.User;
import itman.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/UserController")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 根据用户编号与密码查询用户信息
     * @param userId
     * @param password
     * @return
     */
    @RequestMapping("/getUserByIdByPass")
    public User getUserByIdByPass(String userId, String password) {
        return userService.getUserByIdByPass(userId,password);
    }

    /**
     * 根据用户编号查询用户表返回的行数
     * @param userId
     * @return
     */
    @RequestMapping("/getUserById")
    public int getUserById(String userId) {
        return userService.getUserById(userId);
    }

    /**
     * 向用户表中添加一条记录
     * @param user
     * @return
     */
    @RequestMapping("/saveUser")
    public int saveUser(User user) {
        return userService.saveUser(user);
    }
}
